package PasswordCheckerSegundaIteracao.classes;


public class RuleAtLeastOneDigit implements RuleInterface
{
	
	@Override
	public int aplicaRegra(String passwordDeEntrada)
	{
		if(3 <=digitCounter(passwordDeEntrada))
			return 5;
		else
			return 0;
	}
	
	public static int digitCounter(String inputPassword)
	{
		int contagemDeDigitos = 0;
		
		for(int i = 0; i < inputPassword.length(); i++)
		{
			if(Character.isDigit(inputPassword.charAt(i)))
				contagemDeDigitos++;
		}
		
		return contagemDeDigitos;
	}
	
}
